package t2.server;

import t2.client.rpc.XBeeInit;
import t2.server.xbee.XBeePort;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.rapplogic.xbee.api.XBeeException;

public class XBeeInitImpl extends RemoteServiceServlet implements XBeeInit{

    private static final long serialVersionUID = -2469221314824977517L;

    @Override
    public String xbeeInit(String string) {
        try {
            /* Open the port. */
            XBeePort.getXBeePort().getXbee().open(string, 9600);
            return "success opening " + string;
        } catch (XBeeException e) {
            e.printStackTrace();
            return e.toString();
        }
    }

}
